package com.czz.common.exception;

import lombok.Data;

/**
 * @ClassName: CustomerException
 * @Author Czz
 * @Date 2019/11/15
 * @Time 22:50
 **/
@Data
public class CustomerException extends RuntimeException {
    private Integer code;
    
    /**
    * @Description 
    * @Param [code, message]
    * @Return 
    * @Author Czz
    * @Date 2019/11/15
    * @Time 22:57
    **/
    public CustomerException(Integer code, String message) {
        super(message);
        this.code=code;
    }
    
    /**
    * @Description
    * @Param [resultCodeEnum]
    * @Return 
    * @Author Czz
    * @Date 2019/11/15
    * @Time 22:57
    **/
    public CustomerException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    @Override
    public String toString() {
        return "CustomerException{" +
                "message=" + this.getMessage() +
                ", code=" + code +
                '}';
    }
}
